package dl.bukkit.myststus.vexshow.sub.dynamic;

import dl.bukkit.myststus.library.ats.GVexHud;
import dl.bukkit.myststus.utils.StringUtils;
import lk.vexview.hud.VexShow;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

import java.util.Collections;
import java.util.List;

@GVexHud(
        folder = "status",
        author = "DogLong"
)
public class ScaleHud extends DynamicHandler{

    public static final String THIS_VALUE = "value.this";
    public static final String MAX_VALUE = "value.max";

    private final String thisValue;
    private final String maxValue;

    public ScaleHud(String kye, YamlConfiguration yaml) {
        super(kye, yaml);
        this.thisValue = yaml.getString(THIS_VALUE);
        this.maxValue = yaml.getString(MAX_VALUE);
        addConfigDebug(THIS_VALUE, thisValue);
        addConfigDebug(MAX_VALUE, maxValue);
    }

    @Override
    public double getScale(Player player, Entity entity) {
        return StringUtils.toScale(player, thisValue, maxValue);
    }

    @Override
    public List<VexShow> getVexShowList(Player player, Entity entity) {
        return Collections.singletonList(getDynamicValue(player, entity));
    }
}
